<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue demo</title>
</head>
<body>
    <div>222</div>
    <div id="app">{{message}}</div>
</body>
<script src="lib/vue.js"></script>
<script src="lib/vuex.js"></script>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            message: 'Hello Vue!',
        }
    });
   // 全局使用不需要引用
    Vue.use(Vuex)
    // 注意 Store 大写
    var store = new Vuex.Store({
        state: {
            count: 0
        },
        mutations: {
            increment(state){
                state.count++
            }
        }
    })   
    console.log(store.state.count)
    store.commit('increment')
    console.log(store.state.count)
    
</script>
</html>